import java.util.Scanner;

public class Test2 {
    public void WrongBill2() {
        int ans1 = 0;
        int ans2 = 0;
        int min = 10000;
        int[] array = new int[100001];
        Scanner scanner = new Scanner(System.in);
        int line = scanner.nextInt();
        for (int i = line; i > 0; i--) {
            while(scanner.hasNext()) {
                int x = scanner.nextInt();
                if(x < min) {
                    min = x;
                }
                array[x]++;
                scanner.nextLine();
            }
        }
        for(int i = min; i <= array.length;i++) {
            if(array[i] == 0) {
                ans1 = i;
            }
            if(array[i] == 2) {
                ans2 = i;
            }
            if(ans1 != 0 && ans2 != 0) {
                System.out.print(ans1 + " ");
                System.out.println(ans2);
                scanner.close();
                break;
            }
        }
    }

    public static void main(String[] args) {
        Test2 test2 = new Test2();
        test2.WrongBill2();
    }
}
